#include "serverprotocolaction.h"

QString ServerProtocolAction::getIp() {
	return ip;
}

quint16 ServerProtocolAction::getPort() {
	return port;
}

void ServerProtocolAction::setIp(QString _ip) {
	ip = _ip;
}

void ServerProtocolAction::setPort(quint16 _port) {
	port = _port;
}

/*
 * Server Connection Action
 */

ServerConnectionAction::ServerConnectionAction(ConnectionFunction function, QString login, QString password) : function(function), login(login), password(password) { }

ActionType ServerConnectionAction::getType() {
	return TConnection;
}

ConnectionFunction ServerConnectionAction::getFunction() {
	return function;
}

QString ServerConnectionAction::getLogin() {
	return login;
}

QString ServerConnectionAction::getPassword() {
	return password;
}

/*
 * Server Chat Action
 */

ServerChatAction::ServerChatAction(ChatFunction function, int id) : function(function), id(id) { }

ServerChatAction::ServerChatAction(ChatFunction function, Chat* chat, int id) : function(function), chat(chat), id(id) { }

ServerChatAction::ServerChatAction(ChatFunction function, Chat* chat, QString message) : function(function), chat(chat), message(message) { }

ServerChatAction::ServerChatAction(ChatFunction function, Chat* chat) : function(function), chat(chat) { }

ActionType ServerChatAction::getType() {
	return TChat;
}

ChatFunction ServerChatAction::getFunction() {
	return function;
}

int ServerChatAction::getId() {
	return id;
}

QString ServerChatAction::getMessage() {
	return message;
}

Chat* ServerChatAction::getChat() {
	return chat;
}

/*
 * Server User Action
 */

ServerUserAction::ServerUserAction(UserFunction function, QString string1, QString string2) : function(function), string1(string1), string2(string2) { }

ServerUserAction::ServerUserAction(UserFunction function, Status newStatus) : function(function), newStatus(newStatus) { }

ActionType ServerUserAction::getType() {
	return TUser;
}

UserFunction ServerUserAction::getFunction() {
	return function;
}

QString ServerUserAction::getOldPassword() {
	return string1;
}

QString ServerUserAction::getNewPassword() {
	return string2;
}

QString ServerUserAction::getLogin() {
	return string1;
}

QString ServerUserAction::getPassword() {
	return string2;
}

Status ServerUserAction::getNewStatus() {
	return newStatus;
}

/*
 * Server User Action
 */

ServerFriendAction::ServerFriendAction(FriendFunction function, QString friendLogin) : function(function), login(friendLogin) { }

ServerFriendAction::ServerFriendAction(FriendFunction function, Friend* f) : function(function), f(f) { }

ActionType ServerFriendAction::getType() {
	return TFriend;
}

FriendFunction ServerFriendAction::getFunction() {
	return function;
}

QString ServerFriendAction::getLogin() {
	return login;
}

Friend* ServerFriendAction::getFriend() {
	return f;
}
